<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <title>IconFont</title>
    <link rel="stylesheet" href="/static/css/my/common.css">
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <link rel="stylesheet" href="/static/lib/layui/css/layui.css">

</head>
<body>
<div>
    <div class="layui-container">
        <div class="layui-row">
            <div class="layui-col-md3">
                <div id="test1"></div>
            </div>
            <div class="layui-col-md9">
                <table class="layui-table">
                    <thead>
                        <tr>
                            <th>编号</th>
                            <th>名称</th>
                            <th>备注</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr th:each="department,state:${departmentList}">
                            <td th:text="${department.id}"></td>
                            <td th:text="${department.name}"></td>
                            <td th:text="${department.remark}"></td>
                            <td class="my-td-a">
                                <a th:href="@{'/department/list'}">返回上级部门</a>||
                                <a th:href="@{'/department/add?id='+${department.id}}">添加</a>||
                                <a th:href="@{'/department/queryParent?id='+${department.id}}">查看子部门</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <script type="application/javascript" src="/static/lib/layui/layui.js"></script>
</div>
<script  type="text/javascript" th:inline="javascript">
    var treeList = [[${departmentTreeList}]]
    layui.use(['tree','jquery'], function () {
        var tree = layui.tree;
        //渲染
        var inst1 = tree.render({
            elem: '#test1'  //绑定元素
            , data: treeList
            ,click:function (obj) {
                window.open('/department/queryParent?id='+obj.data.id+"&time=" + Math.random(),'_self')
                //$('iframe').attr('src','/department/queryParent?id='+obj.data.id+"&time=" + Math.random());
            }
        });
    });
</script>
</body>
</html>
